package com.ksd.pug.cloud.config;

import org.springframework.boot.SpringBootConfiguration;
import org.springframework.cloud.netflix.ribbon.RibbonClient;
import org.springframework.cloud.netflix.ribbon.RibbonClients;

/**
 * @author 飞哥
 * @Title: 学相伴出品
 * @Description: 飞哥B站地址：https://space.bilibili.com/490711252
 * 记得关注和三连哦！
 * @Description: 我们有一个学习网站：https://www.kuangstudy.com
 * @date 2022/2/25$ 21:14$
 */
@SpringBootConfiguration
@RibbonClients({
    @RibbonClient(value = "kuangstudy-ribbon-user-service", configuration = MyHashRuleChild.class),
    @RibbonClient(value = "kuangstudy-ribbon-order-service", configuration = com.netflix.loadbalancer.WeightedResponseTimeRule.class)
})
public class RibbonConfiguration {

//    @Bean
//    public IPing ping(){
//        return new DummyPing();
//    }


//    spring-clond --springboot开发---配置类---ioc
//    @Bean
//    public IRule rule(){
//        // 默认规则：RoundRobinRule 也就是简单轮询
//        //return new RoundRobinRule();
//        // 修改成随机规则
//        //return new RoundRobinRule();
//
//        // 500ms重试 +  RoundRobinRule
//        RetryRule retryRule = new RetryRule();
//        retryRule.setMaxRetryMillis(1000);
//        retryRule.setRule(new RandomRule());
//        return retryRule;
//    }
}
